<template>
  <div>
    <ActivityLayout :activityArray="array" :state="mode" :num="page_num" :userId="uid"></ActivityLayout>
  </div>
</template>

<script>
import ActivityLayout from "../../components/activity_layout/activity_layout";
import RequestUtils from "../../utils/requestUtils.js";
export default {
  name: "MyJoined",
  components: {
    ActivityLayout,
  },
  data() {
    return {
      array: [],
      // arraySrc:[],
      mode: "myJoined",
      page_num: 0,
      uid:0
    };
  },
  mounted() {
    let that = this;
    let result = "";
    // let id = that.GLOBAL.id;
    let id = sessionStorage.getItem("id");
    that.uid = id;
    let callback = function (res) {
      console.log("my joined");
      console.log(res);
      result = res.data.result;
      console.log("result is ");
      console.log(result);
      that.array = result.content;
      that.page_num = result.totalPages;
      console.log(that.array);
      for(let i = 0; i < that.array.length; i ++){
        that.array[i] = that.array[i].activityInfo;
      }
    };
    RequestUtils.requestJoinedActivities(that, id, 0, 6, callback, callback);
  },
};
</script>

<style>
</style>